var http =require('http');
var fs = require('fs');

var hostname='127.0.0.1';
var port='3000';

var server=http.createServer(function(req,res){
    fs.readdir('./imgs',function(err,files){
        var wjj=[];
        (function itertor(i){
            if (i==files.length) {
                console.log(wjj);
                return;
            }

            fs.stat('./imgs/'+files[i],function(err,stats){
                if (stats.isDirectory()) {
                    wjj.push(files[i]);
                }

                itertor(i+1);
            });
        })(0);

        console.log(wjj);
    })
    res.end();
});


server.listen(port,hostname);